﻿// <com.woyouqiu.Copyright>
// --------------------------------------------------------------
// <copyright>上海有求网络科技有限公司 2015</copyright>
// <Solution>Vecen.BangChuang</Solution>
// <Project>Vecen.BangChuang.Application</Project>
// <FileName>ChargeMapper.cs</FileName>
// <CreateTime>2017-05-03 15:04</CreateTime>
// <Author>何苗</Author>
// <Email>hemiao@woyouqiu.com</Email>
// <log date="2017-05-03 15:04" version="00001">创建</log>
// --------------------------------------------------------------
// </com.woyouqiu.Copyright>

using AutoMapper;
using Newtonsoft.Json;
using Pingpp.Models;

namespace Vecen.BangChuang.BangChuang.Pay {
    /// <summary>
    /// 支付凭据映射
    /// </summary>
    public class ChargeMapperProfile: Profile {

        /// <summary>
        /// 
        /// </summary>
        public override string ProfileName => "ChargeMapperProfile";

        /// <summary>
        /// 
        /// </summary>
        public ChargeMapperProfile() {
            CreateMap<Charge, ChargeCredential>();

            CreateMap<Event, PingppCallbackEvent>()
                .ForMember(c => c.Data, options => options.MapFrom(source => JsonConvert.SerializeObject(source.Data)));
        }

    }
}